import express from "express";
import MySQLPool from '../mysqlCreatePool';
const router = express.Router();
const db = new MySQLPool();
// 获取奖惩类型字典
router.get("/", async (req: any, res: any) => {
  let tbname = req.query.tb ?? 'tables'
  const sql = `SELECT * FROM ${tbname}`;
  try {
    const [sqlres] = await db.queryResults(sql);
    console.log(sqlres);
    res.send({
      code: 200,
      message: '',
      data: sqlres,
    });
  } catch (e) {
    res.send({
      code: 201,
      message: e,
      data: null,
    });
  }
});
export default router
